#include <iostream>
using namespace std;

int main (void) 
{
	int a = 3;
	int b = 5;
	//(a + b) = 6;  //加法表达式的结果是右值
	//int& res = a+b; //error

	(a = b) = 6; //赋值表达式的结果为左值
	cout << a << endl; //6
	cout << b << endl;

	//+= 是赋值表达式
	int& res = (a+=b); //11  a = a+b;
	cout << res << endl;

	int num = 1;
	cout << ++num << endl;//2
	cout << num << endl;//2
	//前++是左值
	int& rnum = ++++++++++num;//7 
	cout << rnum << endl;
	
	//后++是右值
	num = 1;
	cout << num++ << endl;
	cout << num <<  endl;
	int& rn = num++;//error


	return 0;
}
